package net.tuandn.training.lesson.flexjson;

import net.tuandn.training.model.Person;
import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;
import flexjson.transformer.DateTransformer;

public class DateObjectFactory {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String jsonPerson = "{\"firstName\":\"tuan\",\"lastName\":\"dang\",\"birthday\":\"Mar-02-1985\"}";
		Person tuandn = new JSONDeserializer<Person>().use("birthday", new DateTransformer("MMM-dd-yyyy")).deserialize(jsonPerson, Person.class);
		System.out.println(tuandn.getBirthday());
		System.out.println(new JSONSerializer().exclude("*.class").prettyPrint(true).serialize(tuandn));
	}

}
